<%@ page import="coe.pumbaa.Post" %>
<% def stringManagerService = application.getAttribute("org.codehaus.groovy.grails.APPLICATION_CONTEXT").getBean("stringManagerService") %>
<!doctype html>
<html lang="th">

  <head>
    <meta name="layout" content="PumbaaLayout"/>
    <title>Pumbaa</title>
  </head>
  <body>
    <section id="main" class="column">
      <pumbaa:alert/>
      <article class="module width_full">
        <header><h3>Incoming Event</h3></header>
        <table class="tablesorter" cellspacing="0">
          <thead>
            <tr>
              <th style="width: 20%;">Start</th>
              <th>Event</th>
            </tr>
          </thead>
          <tbody>
          <g:each in="${eventInstanceList}" var="event">
            <tr>
              <td>${event.startTime}</td>
              <td><g:link controller="event" action="show" id="${event.id}">${event.title}</g:link></td>
            </tr>
          </g:each>
          </tbody>
        </table>
        <footer></footer>
      </article>
      <article class="module width_full">
        <header><h3>Content</h3></header>
        <table class="tablesorter" cellspacing="0">
          <thead>
            <tr>
              <th>Title</th>
              <th>likes</th>
              <th style="width: 200px;">Date</th>
            </tr>
          </thead>
          <tbody>
          <g:each in="${postInstanceList}" var="post">
            <tr>
              <td><g:link controller="comment" action="list" id="${post.id}">${stringManagerService.stringToHTML(post.title)}</g:link></td>
            <td>${stringManagerService.countMemberInString(post?.likes)}</td>
            <td><g:formatDate format="dd/MM/yyyy ( HH:mm:ss )" date="${post.timestamp}"/></td>
            </tr>
          </g:each>
          </tbody>
        </table>
      </article>
      <div class="spacer"></div>
    </section>


  </body>

</html>